cmake_minimum_required(VERSION 3.8)
project(voice_planner)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(my_custom_message REQUIRED)

# Generate action interfaces
rosidl_generate_interfaces(${PROJECT_NAME}
  "action/VoicePlanner.action"
)

# Add executable
add_executable(voice_planner_action_server src/voice_planner_action_server.cpp)
ament_target_dependencies(voice_planner_action_server
  rclcpp
  rclcpp_action
  my_custom_message
)

# Link the action interface to the executable
rosidl_get_typesupport_target(cpp_typesupport_target ${PROJECT_NAME} "rosidl_typesupport_cpp")
target_link_libraries(voice_planner_action_server "${cpp_typesupport_target}")

# Install executable
install(TARGETS
  voice_planner_action_server
  DESTINATION lib/${PROJECT_NAME}
)

# Install action files
install(DIRECTORY
  action
  DESTINATION share/${PROJECT_NAME}
)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()

